/**
 * @filename:ContractDetailServiceImpl 2021-11-09 01:40:36
 * @project com/lwl/blue  V1.0
 * Copyright(c) 2018 <a href=mailto:lanwenliang@yidianlife.com>蓝文良</a> Co. Ltd.
 * All right reserved.
 */
package com.lwl.blue.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lwl.blue.commont.base.JsonResult;
import com.lwl.blue.commont.base.PageParam;
import com.lwl.blue.dao.ContractDetailDao;
import com.lwl.blue.entity.ContractDetail;
import com.lwl.blue.service.ContractDetailService;
import com.lwl.blue.vo.GetSupplierByContractIdVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>自定义serviceImpl写在这里</p>
 *
 * <p>说明： 合同明细服务实现层</P>
 * @version: V1.0
 * @author: <a href=mailto:lanwenliang@yidianlife.com>蓝文良</a>
 *
 */
@Service
public class ContractDetailServiceImpl extends ServiceImpl<ContractDetailDao, ContractDetail> implements ContractDetailService {
    @Resource
    ContractDetailDao contractDetailDao;

    @Override
    public JsonResult<Page<ContractDetail>> pages(PageParam<ContractDetail> pageParam) {
        Page<ContractDetail> page = new Page<>(pageParam.getPageNum(), pageParam.getPageSize());
        return new JsonResult<Page<ContractDetail>>().success(contractDetailDao.pages(page, pageParam.getParam()));
    }

    @Override
    public JsonResult<List<GetSupplierByContractIdVO>> getSupplierByContractId(Integer id) {
        List<GetSupplierByContractIdVO> contractDetailList = contractDetailDao.getSupplierByContractId(id);
        return new JsonResult().success(contractDetailList);
    }
}